#include        <stdio.h>
#include        <stdlib.h>
#include        <termios.h>

#define  oops(s,x) { perror(s); exit(x); }

int main(int argc, char *argv[])
{
        struct termios info;

        if ( argc == 1 ) 
        exit(0);

        if ( tcgetattr(0,&info) == -1 )
            oops("tcgettattr", 1);

        if ( argv[1][0] == 'y' )
                info.c_lflag |= ECHO ;/*打开提示符*/
        else
                info.c_lflag &= ~ECHO ;/*隐藏提示符*/

        if ( tcsetattr(0,TCSANOW,&info) == -1 )
               oops("tcsetattr",2);
    
        return 0;
}
